var app = getApp()
var that;
Page({
  data: {
    navRightItems: [],
    page: 1,
    limit: 10,
    loadingHidden: false,
    kongbox: true
  },



  onLoad: function(options) { //获取url携带id值
    that = this

    that.getshopHotlist()
  },
  getshopHotlist() {
    wx.request({
      // url: `http://wx.dcsc520.cn/appapi-0.0.1-SNAPSHOT/hyParductManage/getPageList`,
      url: app.api.getshoplist(),
      method: 'POST',
      data: {
        page: that.data.page,
        limit: that.data.limit,
        type: 2,
        parductSalesVolume: 1,
        companyId: app.globalData.shopData.companyId
      },
      success: function(res) {
        if (res.statusCode == 200 && res.errMsg == 'request:ok') {
          if (res.data.code == 1) {
            if (that.data.page == 1) {
              that.data.navRightItems = []
            }
            if (res.data.list.length == 0) {
              that.setData({
                kongbox: false,
                loadingHidden: true
              })
            }else if (res.data.list.length < that.data.limit) {
              that.setData({
                navRightItems: that.data.navRightItems.concat(res.data.list),
                loadingHidden: true
              })

            } else {
              that.setData({
                navRightItems: that.data.navRightItems.concat(res.data.list),
                page: that.data.page + 1,
              })
            }
          } else {
            wx.showToast({
              title: res.data.message,
            })
          }
        }
      }
    })

  }
})